#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
	int a, b, max = 0, day = 0;
	for (int i = 1; i < 8; i++)
	{
		scanf("%d %d", & a, &b);
		if ((a + b > max) && (a + b > 8))
		{
			max = a + b;
			day = i;
		}
		else
			continue;
	}
	cout << day;
	return 0;
}